package com.hjj.controller;

import com.hjj.dto.ResultDTO;
import com.hjj.exception.MyDateExceptionAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 增强控制器
 */
@RestControllerAdvice
public class MyDateControllerAdvice {

    @ExceptionHandler(MyDateExceptionAdvice.class)
    public ResultDTO get(MyDateExceptionAdvice e){
        ResultDTO resultDTO = new ResultDTO();

        resultDTO.setResult(ResultDTO.ERROR);
        resultDTO.setError(e.getMessage());

        return resultDTO;
    }
}
